package redis

import (
	"context"
	"fmt"
)

const goodstock = "good_stock:good_id_"

func GoodStock(goodId int64, stock int64) error {
	key := goodstock + fmt.Sprintf("%d", goodId)
	for i := 0; i < int(stock); i++ {
		Rdb.LPush(context.Background(), key, goodId)
	}
	return nil
}
func GoodLLen(goodId int64) int64 {
	key := goodstock + fmt.Sprintf("%d", goodId)
	return Rdb.LLen(context.Background(), key).Val()
}
